package com.dimpt.cloud.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: Liujiangfeng
 * @Description:
 * @Date: Created in 8:55 2018-05-24
 * @Version: 1.0
 */
public class ParseHttp {

    private static final String AUTH_HEADER = "Auth";
    private static final String BASIC_PREFIX = "";

    /**
     * 获取Http报文中的Authorization信息
     * @param request
     * @return
     */
    public static String getHttpAuthorization(HttpServletRequest request){

        String token = request.getHeader(AUTH_HEADER);
        if ((token != null) && (token.startsWith(BASIC_PREFIX))) {
            return token.substring(BASIC_PREFIX.length());
        }
        return null;
    }

}
